package com.groot.medical.service;

import java.util.List;

import com.groot.medical.dao.ChronicDao;
import com.groot.medical.dao.ChronicDaoImpl;
import com.groot.medical.entity.ChronicDisease;
import com.groot.medical.entity.PageBean;

public class ChronicServiceImpl implements ChronicService {
	
	private ChronicDao chronicDao = new ChronicDaoImpl();

	@Override
	public PageBean findByPage(int pageNum, int pageSize) {
		int totalRecord = chronicDao.getAllIllTypeCount();
		PageBean pageBean = new PageBean<>(pageNum, pageSize, totalRecord);
		int startIndex = pageBean.getStartIndex();
		pageBean.setList(chronicDao.findIllTypeByPage(startIndex,pageSize));
		return pageBean;
	}

	@Override
	public void AddIllInfo(ChronicDisease ill) {
		chronicDao.AddIllInfo(ill);
		
	}

	@Override
	public ChronicDisease findIllTypeById(String id) {
		ChronicDisease ill = chronicDao.findIllTypeById(id);
		return ill;
	}

	@Override
	public void editIllInfo(ChronicDisease ill) {
		chronicDao.editIllInfo(ill);
		
	}

	@Override
	public int deleteIllTypePage(String id) {
		int flag = chronicDao.deleteIllTypePage(id);
				return flag;
	}

	@Override
	public List<ChronicDisease> findAllChronicInfo() {
		List<ChronicDisease> ills = chronicDao.findAllChronicInfo();
		return ills;
	}

}
